<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="${ctx}/css/common.css" />
<jsp:include page="../inc.jsp"></jsp:include>
<meta http-equiv="X-UA-Compatible" content="edge" />
<style type="text/css"> 
		 .blue_btn{
            border: none;
            border-radius: 5px;
            background-color: #3989c8;
            padding: 5px 5px;
            color:#fff;
          	height:23px;
        }
        .beizhu{
        	color:#fff;
        	border-radius: 5px;
            background-color: #3989c8;
        	width:80px;
        	padding:5px 10px;
        	font-size:14px;
        	text-align:center;
        	margin-top:5px;
        	
        }
        .beizhu:hover{
        cursor: pointer;
        }
        #toolbar{
           	height:50px;
            margin-top: 5px;
            overflow:hidden;
        }
        .list{
            clear: both;
            width: 100%;
            list-style: none;
            padding-left:0px;
        }
        .list li{
            float: left;
            margin-right: 15px;
        }
        .textbox{
            height: 20px;
            margin: 0;
            padding: 0 2px;
            box-sizing: content-box;
            border: 1px solid #95B8E7;
            vertical-align: middle;
			border-radius:3px;
        }
        #tb{
       	padding-left:10px;
      
        }
   		#tb table{
   			border:1px solid #dbdbdb;
   			border-collapse:collapse;
   		}
   		#tb table thead th{
   		border:1px solid #dbdbdb;
   			text-align:center;
   			width:100px;
   			font-size:12px;
   			color:#95B8E7;
   			height:25px;
   		}
   		#tb table td{
   			border:1px solid #dbdbdb;
   			text-align:center;
   			width:100px;
   			font-size:12px;
   		}  
   		.information{
   			width:700px;
   			height:180px;
   			margin-top:10px;
   		}
   		.information li{
   			width:150px;
   			height:22px;
   			line-height:22px;
   			float:left;
   			margin-left:20px;
   			backgound:green;
   			cursor:pointer;
   		}
   		.information li a{
   			font-size:14px;
   			color:black;
   		}
		</style>
		<script type="text/javascript">
		$(function(){
			//消息提醒
			function getInformation(){
				$.ajax({
					type:"post",
					url:"${ctx}/msg/message",
					success:function(data){
						//console.log(data);
						for(var i=0;i<data.obj.length;i++){
							var prefix=data.obj[i];
							//console.log(prefix)
							var url="${ctx}/msg/messageView?createUser="+prefix.createUser+
									"&endTime="+prefix.endTime+"&startTime="+prefix.startTime+
									"&tradeType="+prefix.tradeType+"&status="+prefix.status+"&type="+prefix.type;
							if(prefix.type == 1){
								$("#rechargeCheck").html(data.obj[i].count);
								$("#arechargeCheck").attr("href",url);
							}else if(prefix.type == 2){
								$("#withdrawCheck").html(data.obj[i].count);
								$("#awithdrawCheck").attr("href",url);
							}else if(prefix.type == 3){
								$("#ticketPay").html(data.obj[i].count);
								$("#aticketPay").attr("href",url);
							}else if(prefix.type == 4){
								$("#withdrawPay").html(data.obj[i].count);
								$("#awithdrawPay").attr("href",url);
							}else if(prefix.type == 5){
								$("#contractCheck").html(data.obj[i].count);
								$("#acontractCheck").attr("href",url);
							}else if(prefix.type == 6){
								$("#contractEnd").html(data.obj[i].count);
								$("#acontractEnd").attr("href",url);
							}else if(prefix.type == 7){
								$("#contractCancel").html(data.obj[i].count);
								$("#acontractCancel").attr("href",url);
							}else if(prefix.type == 8){
								$("#ticketSuccess").html(data.obj[i].count);
								$("#aticketSuccess").attr("href",url);
							};
								
						};
					},
					error:function(msg){
						layer.alert("请检查您的网络连接，然后重试！");
					}
				});
			};
			getInformation();
			//点击按照条件查询
			$("#query").click(function(){
				var deptCityName = "";
				var arrCityName = "";
				var deptCity="";//出发城市
				var arrCity="";//到达城市
				var deptDate="";//出发日期
				var seatClass="";//舱位
				var charterType="";//类型
				var routingType="";
				charterType=3;
				deptCityName=$("#homecity_name").val();
				arrCityName=$("#getcity_name").val();
				deptCity=$("#startCity").val();
				arrCity=$("#arrCity").val();
				deptStartDate=$("#startDate").val();
				deptEndDate=$("#endDate").val();
				seatClass=$("#seat").combobox("getValue");
				routingType=$('input[name="routingType"]:checked').val();
				var url = '/np/query?deptCity='+deptCity+'&arrCity='+arrCity+'&deptStartDate='+deptStartDate+'&deptEndDate='+deptEndDate+'&seatClass='+seatClass+'&charterType='+charterType+'&routingType='+routingType+'&deptCityName='+deptCityName+'&arrCityName='+arrCityName+'&temp='+Math.random();
				window.parent.addTab({title : "散客预定",url : url});
			});
			$("#queryQw").click(function(){
				var deptCityName = "";
				var arrCityName = "";
				var deptCity="";//出发城市
				var arrCity="";//到达城市
				var deptDate="";//出发日期
				var seatClass="";//舱位
				var charterType="";//类型 1硬切
				var sortType="deptDate";//排序方式
				var routingType="ROUND";//往返类型
				var seatCount="";//座位数
				var deptStartDate = addDate(2);
				charterType=1;
				deptCityName=$("#homecity_name1").val();
				arrCityName=$("#getcity_name1").val();
				deptCity=$("#startCity1").val();
				arrCity=$("#arrCity1").val();
				//deptDate=$("#startDate").val();
				seatCount=$("#seatCount").val();
				seatClass=$("#seat1").combobox("getValue");
				//deptCity=deptCity.replace('{$startCity}','');
				//arrCity=arrCity.replace('{$arrCity}','');
				$("#count").val(seatCount);
				if(arrCity == ""){
					jQuery.messager.alert('提示:','到达城市输入有误!'); 
					return false;
				}
				if(seatClass == ""){
					jQuery.messager.alert('提示:','舱位不能为空!'); 
					return false;
				}
				if(seatCount == ""){
					jQuery.messager.alert('提示:','座位数不能为空!'); 
					return false;
				} 
				var url = '/np/queryQw?deptCity='+deptCity+'&arrCity='+arrCity+'&deptStartDate='+deptStartDate+'&seatClass='+seatClass+'&charterType='+charterType+'&sortType='+sortType+'&seatCount='+seatCount+'&routingType='+routingType+'&deptCityName='+deptCityName+'&arrCityName='+arrCityName+'&temp='+Math.random();
				window.parent.addTab({title : "切位预定",url : url});
			});
		});
		function addDate(days) {
			var d = new Date();
			d.setDate(d.getDate() + days);
			var month = d.getMonth() + 1;
			var day = d.getDate();
			if (month < 10) {
				month = "0" + month;
			}
			if (day < 10) {
				day = "0" + day;
			}
			var val = d.getFullYear() + "-" + month + "-" + day;
			return val;
		};
		function jump(title,url){
			window.parent.addTab({title : title,url : url});
		};
		</script>
</head>
<body >
<div class="easyui-layout" fit="true">
		<div class="easyui-panel" title="消息提醒" style="height: 100px;"> 
			<ul class="information">
				<li><a id="arechargeCheck">充值审核结果(<span id="rechargeCheck"></span>)</a></li>
				<li><a id="awithdrawCheck" href="###">提现审核结果(<span id="withdrawCheck"></span>)</a></li>
				<li><a id="aticketPay" href="###">票款付款结果(<span id="ticketPay"></span>)</a></li>
				<li><a id="awithdrawPay" href="###">押金付款结果(<span id="withdrawPay"></span>)</a></li>
				<li><a id="acontractCheck" href="###">合同审核结果(<span id="contractCheck"></span>)</a></li>
				<li><a id="acontractEnd" href="###">合同终止(<span id="contractEnd"></span>)</a></li>
				<li><a id="acontractCancel" href="###">合同取消(<span id="contractCancel"></span>)</a></li>
				<li><a id="aticketSuccess" href="###">出票完成提醒(<span id="ticketSuccess"></span>)</a></li>
			</ul>
		</div>
        <div class="easyui-panel" style="height: 150px;"> 
	       <div id="tt" class="easyui-tabs" style="width:100px;height:auto" fit="true">
			<div title="散客预定" style="padding:10px">
				<ul class="list">
		            <li>出发城市： 
		            <input type="text" value="" size="15" id="homecity_name" name="homecity_name" style="width:150px;height: 23px" mod="address|notice" mod_address_source="hotel" mod_address_suggest="" mod_address_reference="startCity" mod_notice_tip="中文/拼音" />
					<input id="startCity" name="startCity" type="hidden" value="" />
		            </li>
		            <li>
					到达城市：
					<input type="text" value="" size="15" id="getcity_name" name="getcity_name" style="width:150px;height: 23px" mod="address|notice" mod_address_source="hotel"  mod_address_reference="arrCity" mod_notice_tip="中文/拼音" />
					<input id="arrCity" name="arrCity" type="hidden" value="" />
		            </li>
		            <li>
		              	  出发日期：
		             <input type="text" id="startDate" class="textbox" value="${requestScope.deptDate}" onFocus="new WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'%y-%M-\#{%d+2}',maxDate:'#F{$dp.$D(\'endDate\')}'})" style="width: 155px;height: 20px"/>
               		 至<input type="text" id="endDate" class="textbox" value="${requestScope.endDate}" onFocus="new WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'startDate\')}'})" style="width: 155px;height: 20px"/>
		            </li>
		            <li>
		               	 舱位：
		                <select class="easyui-combobox"  data-options="panelHeight:'auto'" id="seat"style="height:23px">
		                	<option value="">请选择</option>
		                    <option value="E">经济舱</option>
		                    <option value="F">头等舱</option>
		                    <option value="C">商务舱</option>
		                    <option value="S">bootTable</option>
		                </select>
		            </li>
		            <li style="line-height: 20px">
		            	航程类型：
		            <input type="radio" style="width:15px;" name="routingType" id="routeType1" value="ROUND" checked="checked"><label for="routeType1">往返程</label>
		            <input type="radio" style="width:15px;" name="routingType" id="routeType2" value="TO"><label for="routeType2">单程</label>
		            </li>
		            <li><input type="button" value="查询" class="blue_btn" id="query"/></li>
		        </ul>
			</div>
			<div title="切位预定" style="padding:10px">
				<ul class="list">
	            <li>出发城市： 
	            <input type="text" value="" size="15" id="homecity_name1" name="homecity_name1" style="width:150px;height: 23px" mod="address|notice" mod_address_source="hotel" mod_address_suggest="" mod_address_reference="startCity1" mod_notice_tip="中文/拼音" />
				<input id="startCity1" name="startCity1" type="hidden" value="" />
	            </li>
	            <li>
				到达城市：
				<input type="text" value="" size="15" id="getcity_name1" name="getcity_name1" style="width:150px;height: 23px" mod="address|notice" mod_address_source="hotel"  mod_address_reference="arrCity1" mod_notice_tip="中文/拼音" />
				<input id="arrCity1" name="arrCity1" type="hidden" value="" />
	            </li>
	            <li>
	               	 舱位：
	                <select class="easyui-combobox"  data-options="panelHeight:'auto'" id="seat1" style="height:23px">
	                	<option value="">请选择</option>
	                    <option value="E">经济舱</option>
	                    <option value="F">头等舱</option>
	                    <option value="C">商务舱</option>
	                    <option value="S">bootTable</option>
	                </select>
	            </li>
	            <li>
	              	座位数：
	                <input type="text" id="seatCount"  style="width:150px;height: 23px"/>
	            </li>
	            <li><input type="button" value="查询" class="blue_btn" id="queryQw"/></li>
	        </ul>
			</div> 
		</div> 
    </div>
</div>

<script type="text/javascript" src="${ctx }/jslib/airport/fixdiv.js"></script>
<script type="text/javascript" src="${ctx }/jslib/airport/address.js"></script>
 <script type="text/javascript">
		$(function(){
			var tabs = $('#tt').tabs().tabs('tabs');
			for(var i=0; i<tabs.length; i++){
				tabs[i].panel('options').tab.unbind().bind('mouseenter',{index:i},function(e){
					$('#tt').tabs('select', e.data.index);
				});
			};
		});
	</script>
</body>
</html>